WOLF core
WOLF: A Modular Estimation Framework for Robotics
XXXXXXXXXXXXXXXXXXXXXXXXvoid(0)" frameborder="0" name="MSearchResults" id="MSearchResults">
motion_buffer.h
Go to the documentation of this file.
1// WOLF - Copyright (C) 2020-2026
2// Institut de Robòtica i Informàtica Industrial, CSIC-UPC.
3// Authors: Joan Solà Ortega (jsola@iri.upc.edu) and
4// Joan Vallvé Navarro (jvallve@iri.upc.edu)
5// All rights reserved.
6//
7// This file is part of WOLF: http://www.iri.upc.edu/wolf
8// WOLF is free software: you can redistribute it and/or modify
9// it under the terms of the GNU General Public License version 3
10// as published by the Free Software Foundation.
11//
12// This program is distributed in the hope that it will be useful,
13// but WITHOUT ANY WARRANTY; without even the implied warranty of
14// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15// GNU General Public License for more details.
16//
17// You should have received a copy of the GNU General Public License
18// along with this program. If not, see <http://www.gnu.org/licenses/>.
19#pragma once
20
21#include "core/common/wolf.h"
23
24#include <list>
25#include <algorithm>
26
27namespace wolf
28{
32struct Motion
33{
34 public:
40 Eigen::VectorXd data_;
41 Eigen::MatrixXd data_cov_;
42 Eigen::VectorXd delta_;
43 Eigen::MatrixXd delta_cov_;
44 Eigen::VectorXd delta_integr_;
45 Eigen::MatrixXd delta_integr_cov_;
46 Eigen::MatrixXd jacobian_delta_;
47 Eigen::MatrixXd jacobian_delta_integr_;
48 Eigen::MatrixXd jacobian_calib_;
49 public:
52 Motion() = delete; // completely delete unpredictable stuff like this
53
56 Motion(const TimeStamp& _ts,
57 SizeEigen _data_size,
58 SizeEigen _delta_size,
59 SizeEigen _cov_size,
60 SizeEigen _calib_size);
61
64 Motion(const TimeStamp& _ts,
65 const Eigen::VectorXd& _data,
66 const Eigen::MatrixXd& _data_cov,
67 const Eigen::VectorXd& _delta,
68 const Eigen::MatrixXd& _delta_cov,
69 const Eigen::VectorXd& _delta_int,
70 const Eigen::MatrixXd& _delta_integr_cov,
71 const Eigen::MatrixXd& _jac_delta,
72 const Eigen::MatrixXd& _jac_delta_int,
73 const Eigen::MatrixXd& _jacobian_calib);
74
77 ~Motion();
78
79 private:
82 void resize(SizeEigen _data_s, SizeEigen _delta_s, SizeEigen _delta_cov_s, SizeEigen _calib_s);
83
84}; // One instance of the buffered data, corresponding to a particular time stamp.
85
107class MotionBuffer : public std::list<Motion>
108{
109 public:
112 MotionBuffer();
113
116 const Motion& getMotion(const TimeStamp& _ts) const;
117
120 void getMotion(const TimeStamp& _ts, Motion& _motion) const;
121
126 const Motion& getClosestMotion(const TimeStamp& _ts) const;
127
130 void split(const TimeStamp& _ts, MotionBuffer& _oldest_buffer);
131
134 void print(bool show_data = 0,
135 bool show_delta = 0,
136 bool show_delta_int = 0,
137 bool show_jacs = 0,
138 bool show_covs = 0);
139};
140
141} // namespace wolf
Buffer of motions (pre-integrated deltas) of a CaptureMotion.
Definition: motion_buffer.h:108
void split(const TimeStamp &_ts, MotionBuffer &_oldest_buffer)
Splits the buffer at _ts: the motions up to _ts are moved to _oldest_buffer.
Definition: motion_buffer.cpp:131
void print(bool show_data=0, bool show_delta=0, bool show_delta_int=0, bool show_jacs=0, bool show_covs=0)
Prints the buffer, optionally showing data, deltas, integrated deltas, Jacobians and covariances.
Definition: motion_buffer.cpp:151
const Motion & getClosestMotion(const TimeStamp &_ts) const
Returns the motion with the closest time stamp to _ts (the previous one in case of draw)
Definition: motion_buffer.cpp:109
MotionBuffer()
Default constructor.
Definition: motion_buffer.cpp:80
const Motion & getMotion(const TimeStamp &_ts) const
Returns the motion at _ts, following the rules of the class description.
Definition: motion_buffer.cpp:85
TimeStamp implements basic functionalities for time stamps.
Definition: time_stamp.h:39
Definition: capture_base.h:23
EIGEN_DEFAULT_DENSE_INDEX_TYPE SizeEigen
Vector and Matrices size type for the Wolf project.
Definition: wolf.h:58
Motion of the buffer at a time stamp: the data, the delta and the integrated delta,...
Definition: motion_buffer.h:33
Motion()=delete
Default constructor (deleted)
SizeEigen cov_size_
Size of the delta covariance.
Definition: motion_buffer.h:37
SizeEigen data_size_
Size of the data vector.
Definition: motion_buffer.h:35
Eigen::VectorXd delta_integr_
The integrated motion or delta-integral.
Definition: motion_buffer.h:44
Eigen::MatrixXd data_cov_
Covariance of the instantaneous data.
Definition: motion_buffer.h:41
Motion(const TimeStamp &_ts, const Eigen::VectorXd &_data, const Eigen::MatrixXd &_data_cov, const Eigen::VectorXd &_delta, const Eigen::MatrixXd &_delta_cov, const Eigen::VectorXd &_delta_int, const Eigen::MatrixXd &_delta_integr_cov, const Eigen::MatrixXd &_jac_delta, const Eigen::MatrixXd &_jac_delta_int, const Eigen::MatrixXd &_jacobian_calib)
Constructor from all the values.
Eigen::MatrixXd jacobian_delta_
Jacobian of the integration wrt delta_.
Definition: motion_buffer.h:46
~Motion()
Destructor.
Definition: motion_buffer.cpp:63
TimeStamp ts_
Time stamp.
Definition: motion_buffer.h:39
Eigen::MatrixXd jacobian_calib_
Jacobian of delta_integr wrt extra states (TBD by the derived processors)
Definition: motion_buffer.h:48
SizeEigen calib_size_
Size of the calibration vector.
Definition: motion_buffer.h:38
Eigen::VectorXd data_
Instantaneous motion data.
Definition: motion_buffer.h:40
Eigen::MatrixXd delta_integr_cov_
Covariance of the integrated delta.
Definition: motion_buffer.h:45
Eigen::VectorXd delta_
Instantaneous motion delta.
Definition: motion_buffer.h:42
SizeEigen delta_size_
Size of the delta vector.
Definition: motion_buffer.h:36
Eigen::MatrixXd delta_cov_
Covariance of the instantaneous delta.
Definition: motion_buffer.h:43
Eigen::MatrixXd jacobian_delta_integr_
Jacobian of the integration wrt delta_integr_.
Definition: motion_buffer.h:47